

const initTable = (id, data, formatter)=>{
    $(`#${id}`).bootstrapTable({
        columns: [{
            field: 'username',
            title: '用户名'
        }, {
            field: 'phone',
            title: '用户手机号'
        }, {
            field: 'email',
            title: '用户邮箱'
        },{
            field: 'created_at',
            title: '用户注册时间'
        },
            {
                field: 'operate',
                title: '操作',
                align: 'center',
                formatter: formatter
            }],
        data
    })
}

function removeUser(id){
    var data = {
        id
    };
    $.ajax({
        type: 'POST',
        url: '/api/remove',
        data: JSON.stringify(data),
        success: function (resp) {
            if (resp.code === 200) {
                alert('删除成功');
                location.reload();
            } else {
                alert(resp.info)
            }
        },
        contentType: 'application/json',
        dataType: 'json'
    });
}